<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>H+移动工作平台 - 资产调拨与转移</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <link rel="stylesheet" href="../css/styles.css">
</head>
<body>
  <div class="device-container">
    <!-- 状态栏 -->
    <div class="status-bar">
      <div class="status-bar-left">
        <span class="time">9:41</span>
      </div>
      <div class="status-bar-right">
        <i class="fas fa-signal signal"></i>
        <i class="fas fa-wifi wifi"></i>
        <i class="fas fa-battery-full battery"></i>
      </div>
    </div>
    
    <!-- 导航栏 -->
    <div class="nav-bar">
      <div class="nav-left">
        <a href="asset.html"><i class="fas fa-arrow-left"></i></a>
      </div>
      <div class="nav-title">资产调拨与转移</div>
      <div class="nav-right">
        <i class="fas fa-question-circle"></i>
      </div>
    </div>
    
    <!-- 内容区域 -->
    <div class="app-content">
      <!-- 选项卡 -->
      <div class="tabs mx-4 mt-4">
        <div class="tab active" data-tab="transfer">资产转移</div>
        <div class="tab" data-tab="allocation">资产调拨</div>
      </div>
      
      <!-- 资产转移表单 -->
      <div class="tab-content active" id="transfer-content">
        <form id="transferForm" class="p-4">
          <!-- 资产选择 -->
          <div class="form-group">
            <label class="form-label">选择资产</label>
            <div class="input-group" id="assetSelector">
              <input type="text" readonly placeholder="点击选择需要转移的资产" class="form-input">
              <i class="fas fa-chevron-right text-gray-400"></i>
            </div>
          </div>
          
          <!-- 当前使用人 -->
          <div class="form-group">
            <label class="form-label">当前使用人</label>
            <input type="text" class="form-input" readonly value="张三 (信息科技部)">
          </div>
          
          <!-- 转移类型 -->
          <div class="form-group">
            <label class="form-label">转移类型</label>
            <div class="grid grid-cols-2 gap-2">
              <div class="radio-card">
                <input type="radio" name="transferType" id="userTransfer" value="user" checked>
                <label for="userTransfer">
                  <div class="radio-icon bg-blue-100">
                    <i class="fas fa-user-friends text-blue-500"></i>
                  </div>
                  <div class="radio-text">人员转移</div>
                </label>
              </div>
              
              <div class="radio-card">
                <input type="radio" name="transferType" id="deptTransfer" value="department">
                <label for="deptTransfer">
                  <div class="radio-icon bg-green-100">
                    <i class="fas fa-building text-green-500"></i>
                  </div>
                  <div class="radio-text">部门转移</div>
                </label>
              </div>
            </div>
          </div>
          
          <!-- 新使用人 -->
          <div class="form-group transfer-user-fields">
            <label class="form-label">新使用人</label>
            <div class="input-group" id="userSelector">
              <input type="text" readonly placeholder="点击选择新使用人" class="form-input">
              <i class="fas fa-chevron-right text-gray-400"></i>
            </div>
          </div>
          
          <!-- 新部门 -->
          <div class="form-group transfer-dept-fields" style="display: none;">
            <label class="form-label">新部门</label>
            <div class="input-group" id="deptSelector">
              <input type="text" readonly placeholder="点击选择新部门" class="form-input">
              <i class="fas fa-chevron-right text-gray-400"></i>
            </div>
          </div>
          
          <!-- 转移原因 -->
          <div class="form-group">
            <label class="form-label">转移原因</label>
            <textarea class="form-textarea" rows="3" placeholder="请输入资产转移原因..."></textarea>
          </div>
          
          <!-- 转移时间 -->
          <div class="form-group">
            <label class="form-label">转移时间</label>
            <input type="date" class="form-input" value="2024-05-15">
          </div>
          
          <!-- 备注 -->
          <div class="form-group">
            <label class="form-label">备注</label>
            <textarea class="form-textarea" rows="2" placeholder="其他需要说明的情况..."></textarea>
          </div>
          
          <!-- 提交按钮 -->
          <div class="mt-8">
            <button type="submit" class="btn-primary w-full">提交转移申请</button>
          </div>
        </form>
      </div>
      
      <!-- 资产调拨表单 -->
      <div class="tab-content" id="allocation-content" style="display: none;">
        <form id="allocationForm" class="p-4">
          <!-- 调拨类型 -->
          <div class="form-group">
            <label class="form-label">调拨类型</label>
            <div class="grid grid-cols-2 gap-2">
              <div class="radio-card">
                <input type="radio" name="allocationType" id="singleAllocation" value="single" checked>
                <label for="singleAllocation">
                  <div class="radio-icon bg-blue-100">
                    <i class="fas fa-laptop text-blue-500"></i>
                  </div>
                  <div class="radio-text">单项调拨</div>
                </label>
              </div>
              
              <div class="radio-card">
                <input type="radio" name="allocationType" id="batchAllocation" value="batch">
                <label for="batchAllocation">
                  <div class="radio-icon bg-green-100">
                    <i class="fas fa-boxes text-green-500"></i>
                  </div>
                  <div class="radio-text">批量调拨</div>
                </label>
              </div>
            </div>
          </div>
          
          <!-- 资产选择 -->
          <div class="form-group">
            <label class="form-label">选择资产</label>
            <div class="input-group" id="allocationAssetSelector">
              <input type="text" readonly placeholder="点击选择需要调拨的资产" class="form-input">
              <i class="fas fa-chevron-right text-gray-400"></i>
            </div>
          </div>
          
          <!-- 当前部门 -->
          <div class="form-group">
            <label class="form-label">当前部门</label>
            <input type="text" class="form-input" readonly value="信息科技部">
          </div>
          
          <!-- 调入部门 -->
          <div class="form-group">
            <label class="form-label">调入部门</label>
            <div class="input-group" id="targetDeptSelector">
              <input type="text" readonly placeholder="点击选择调入部门" class="form-input">
              <i class="fas fa-chevron-right text-gray-400"></i>
            </div>
          </div>
          
          <!-- 调拨原因 -->
          <div class="form-group">
            <label class="form-label">调拨原因</label>
            <textarea class="form-textarea" rows="3" placeholder="请输入资产调拨原因..."></textarea>
          </div>
          
          <!-- 调拨时间 -->
          <div class="form-group">
            <label class="form-label">调拨时间</label>
            <input type="date" class="form-input" value="2024-05-15">
          </div>
          
          <!-- 是否需要验收 -->
          <div class="form-group">
            <label class="form-label">是否需要验收</label>
            <div class="flex items-center mt-2">
              <label class="inline-flex items-center mr-4">
                <input type="radio" name="needAcceptance" value="yes" checked class="form-radio">
                <span class="ml-2">是</span>
              </label>
              <label class="inline-flex items-center">
                <input type="radio" name="needAcceptance" value="no" class="form-radio">
                <span class="ml-2">否</span>
              </label>
            </div>
          </div>
          
          <!-- 备注 -->
          <div class="form-group">
            <label class="form-label">备注</label>
            <textarea class="form-textarea" rows="2" placeholder="其他需要说明的情况..."></textarea>
          </div>
          
          <!-- 提交按钮 -->
          <div class="mt-8">
            <button type="submit" class="btn-primary w-full">提交调拨申请</button>
          </div>
        </form>
      </div>
    </div>
    
    <!-- 底部标签栏 -->
    <div class="tab-bar">
      <a href="home.html" class="tab-item">
        <i class="fas fa-home tab-icon"></i>
        <span>首页</span>
      </a>
      <a href="asset.html" class="tab-item active">
        <i class="fas fa-laptop tab-icon"></i>
        <span>资产</span>
      </a>
      <a href="finance.html" class="tab-item">
        <i class="fas fa-wallet tab-icon"></i>
        <span>财务</span>
      </a>
      <a href="material.html" class="tab-item">
        <i class="fas fa-box tab-icon"></i>
        <span>物资</span>
      </a>
      <a href="profile.html" class="tab-item">
        <i class="fas fa-user tab-icon"></i>
        <span>我的</span>
      </a>
    </div>
  </div>
  
  <!-- 资产选择模态框 -->
  <div class="modal" id="assetModal">
    <div class="modal-content">
      <div class="modal-header">
        <div class="modal-title">选择资产</div>
        <button class="modal-close"><i class="fas fa-times"></i></button>
      </div>
      <div class="modal-body">
        <div class="search-box mb-4">
          <i class="fas fa-search search-icon"></i>
          <input type="text" placeholder="搜索资产编号或名称" class="search-input">
        </div>
        <div class="asset-list">
          <div class="asset-item" data-id="A2023001">
            <div class="asset-info">
              <div class="asset-name">联想ThinkPad X1 Carbon</div>
              <div class="asset-meta">编号: A2023001 | 状态: 在用</div>
            </div>
            <div class="asset-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
          <div class="asset-item" data-id="A2023002">
            <div class="asset-info">
              <div class="asset-name">戴尔 OptiPlex 7080</div>
              <div class="asset-meta">编号: A2023002 | 状态: 在用</div>
            </div>
            <div class="asset-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
          <div class="asset-item" data-id="A2023003">
            <div class="asset-info">
              <div class="asset-name">惠普 LaserJet Pro M428fdw</div>
              <div class="asset-meta">编号: A2023003 | 状态: 在用</div>
            </div>
            <div class="asset-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button class="btn-secondary" id="cancelAssetSelect">取消</button>
        <button class="btn-primary" id="confirmAssetSelect">确定</button>
      </div>
    </div>
  </div>
  
  <!-- 人员选择模态框 -->
  <div class="modal" id="userModal">
    <div class="modal-content">
      <div class="modal-header">
        <div class="modal-title">选择人员</div>
        <button class="modal-close"><i class="fas fa-times"></i></button>
      </div>
      <div class="modal-body">
        <div class="search-box mb-4">
          <i class="fas fa-search search-icon"></i>
          <input type="text" placeholder="搜索姓名或工号" class="search-input">
        </div>
        <div class="user-list">
          <div class="user-item" data-id="U001">
            <div class="user-info">
              <div class="user-name">李四</div>
              <div class="user-meta">工号: U001 | 部门: 信息科技部</div>
            </div>
            <div class="user-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
          <div class="user-item" data-id="U002">
            <div class="user-info">
              <div class="user-name">王五</div>
              <div class="user-meta">工号: U002 | 部门: 财务部</div>
            </div>
            <div class="user-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
          <div class="user-item" data-id="U003">
            <div class="user-info">
              <div class="user-name">赵六</div>
              <div class="user-meta">工号: U003 | 部门: 人力资源部</div>
            </div>
            <div class="user-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button class="btn-secondary" id="cancelUserSelect">取消</button>
        <button class="btn-primary" id="confirmUserSelect">确定</button>
      </div>
    </div>
  </div>
  
  <!-- 部门选择模态框 -->
  <div class="modal" id="deptModal">
    <div class="modal-content">
      <div class="modal-header">
        <div class="modal-title">选择部门</div>
        <button class="modal-close"><i class="fas fa-times"></i></button>
      </div>
      <div class="modal-body">
        <div class="search-box mb-4">
          <i class="fas fa-search search-icon"></i>
          <input type="text" placeholder="搜索部门名称" class="search-input">
        </div>
        <div class="dept-list">
          <div class="dept-item" data-id="D001">
            <div class="dept-info">
              <div class="dept-name">财务部</div>
              <div class="dept-meta">部门编号: D001</div>
            </div>
            <div class="dept-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
          <div class="dept-item" data-id="D002">
            <div class="dept-info">
              <div class="dept-name">人力资源部</div>
              <div class="dept-meta">部门编号: D002</div>
            </div>
            <div class="dept-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
          <div class="dept-item" data-id="D003">
            <div class="dept-info">
              <div class="dept-name">医疗部</div>
              <div class="dept-meta">部门编号: D003</div>
            </div>
            <div class="dept-select">
              <i class="fas fa-check-circle"></i>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button class="btn-secondary" id="cancelDeptSelect">取消</button>
        <button class="btn-primary" id="confirmDeptSelect">确定</button>
      </div>
    </div>
  </div>
  
  <script>
    // 选项卡切换
    document.querySelectorAll('.tab').forEach(tab => {
      tab.addEventListener('click', function() {
        // 移除所有选项卡的active类
        document.querySelectorAll('.tab').forEach(t => {
          t.classList.remove('active');
        });
        
        // 隐藏所有内容
        document.querySelectorAll('.tab-content').forEach(content => {
          content.style.display = 'none';
        });
        
        // 激活当前选项卡
        this.classList.add('active');
        
        // 显示对应内容
        const tabId = this.getAttribute('data-tab');
        document.getElementById(`${tabId}-content`).style.display = 'block';
      });
    });
    
    // 转移类型切换
    document.querySelectorAll('input[name="transferType"]').forEach(radio => {
      radio.addEventListener('change', function() {
        if (this.value === 'user') {
          document.querySelector('.transfer-user-fields').style.display = 'block';
          document.querySelector('.transfer-dept-fields').style.display = 'none';
        } else if (this.value === 'department') {
          document.querySelector('.transfer-user-fields').style.display = 'none';
          document.querySelector('.transfer-dept-fields').style.display = 'block';
        }
      });
    });
    
    // 资产选择模态框
    const assetSelector = document.getElementById('assetSelector');
    const assetModal = document.getElementById('assetModal');
    const cancelAssetSelect = document.getElementById('cancelAssetSelect');
    const confirmAssetSelect = document.getElementById('confirmAssetSelect');
    
    assetSelector.addEventListener('click', function() {
      assetModal.classList.add('active');
    });
    
    document.getElementById('allocationAssetSelector').addEventListener('click', function() {
      assetModal.classList.add('active');
    });
    
    cancelAssetSelect.addEventListener('click', function() {
      assetModal.classList.remove('active');
    });
    
    confirmAssetSelect.addEventListener('click', function() {
      const selectedAsset = document.querySelector('.asset-item.selected');
      if (selectedAsset) {
        const assetName = selectedAsset.querySelector('.asset-name').textContent;
        document.querySelector('#assetSelector input').value = assetName;
        document.querySelector('#allocationAssetSelector input').value = assetName;
      }
      assetModal.classList.remove('active');
    });
    
    // 人员选择模态框
    const userSelector = document.getElementById('userSelector');
    const userModal = document.getElementById('userModal');
    const cancelUserSelect = document.getElementById('cancelUserSelect');
    const confirmUserSelect = document.getElementById('confirmUserSelect');
    
    userSelector.addEventListener('click', function() {
      userModal.classList.add('active');
    });
    
    cancelUserSelect.addEventListener('click', function() {
      userModal.classList.remove('active');
    });
    
    confirmUserSelect.addEventListener('click', function() {
      const selectedUser = document.querySelector('.user-item.selected');
      if (selectedUser) {
        const userName = selectedUser.querySelector('.user-name').textContent;
        userSelector.querySelector('input').value = userName;
      }
      userModal.classList.remove('active');
    });
    
    // 部门选择模态框
    const deptSelector = document.getElementById('deptSelector');
    const targetDeptSelector = document.getElementById('targetDeptSelector');
    const deptModal = document.getElementById('deptModal');
    const cancelDeptSelect = document.getElementById('cancelDeptSelect');
    const confirmDeptSelect = document.getElementById('confirmDeptSelect');
    
    deptSelector.addEventListener('click', function() {
      deptModal.classList.add('active');
      deptModal.dataset.source = 'deptSelector';
    });
    
    targetDeptSelector.addEventListener('click', function() {
      deptModal.classList.add('active');
      deptModal.dataset.source = 'targetDeptSelector';
    });
    
    cancelDeptSelect.addEventListener('click', function() {
      deptModal.classList.remove('active');
    });
    
    confirmDeptSelect.addEventListener('click', function() {
      const selectedDept = document.querySelector('.dept-item.selected');
      if (selectedDept) {
        const deptName = selectedDept.querySelector('.dept-name').textContent;
        if (deptModal.dataset.source === 'deptSelector') {
          deptSelector.querySelector('input').value = deptName;
        } else if (deptModal.dataset.source === 'targetDeptSelector') {
          targetDeptSelector.querySelector('input').value = deptName;
        }
      }
      deptModal.classList.remove('active');
    });
    
    // 资产项选择
    document.querySelectorAll('.asset-item').forEach(item => {
      item.addEventListener('click', function() {
        document.querySelectorAll('.asset-item').forEach(el => {
          el.classList.remove('selected');
        });
        this.classList.add('selected');
      });
    });
    
    // 人员项选择
    document.querySelectorAll('.user-item').forEach(item => {
      item.addEventListener('click', function() {
        document.querySelectorAll('.user-item').forEach(el => {
          el.classList.remove('selected');
        });
        this.classList.add('selected');
      });
    });
    
    // 部门项选择
    document.querySelectorAll('.dept-item').forEach(item => {
      item.addEventListener('click', function() {
        document.querySelectorAll('.dept-item').forEach(el => {
          el.classList.remove('selected');
        });
        this.classList.add('selected');
      });
    });
    
    // 表单提交
    document.getElementById('transferForm').addEventListener('submit', function(e) {
      e.preventDefault();
      alert('资产转移申请已提交，等待审批');
      // 实际应用中这里应该有AJAX请求提交表单数据
    });
    
    document.getElementById('allocationForm').addEventListener('submit', function(e) {
      e.preventDefault();
      alert('资产调拨申请已提交，等待审批');
      // 实际应用中这里应该有AJAX请求提交表单数据
    });
    
    // 关闭所有模态框
    document.querySelectorAll('.modal-close').forEach(button => {
      button.addEventListener('click', function() {
        this.closest('.modal').classList.remove('active');
      });
    });
  </script>
</body>
</html>